package com.frogs.ucenter.service;

import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;

public interface ShoppingCartService {
	
	/**
	 * 删除购物车
	 * @param userId
	 * @param id 购物车中的记录id
	 * @param applicablePlatformId
	 * @return
	 */
	JSONObject deleteShoppingCart(Integer userId, Integer id, Integer applicablePlatformId) throws Exception;
	
	/**
	 * 修改购物车
	 * @param userId
	 * @param id 购物车中的记录id
	 * @param amount
	 * @return
	 */
	JSONObject updateShoppingCart(Integer userId,Integer id,Integer amount) throws Exception;

	/**
	 * 获取购物车列表(关联商品信息)
	 * @param userId
	 * @param applicablePlatformId平台id {@link ApplicablePlatformEnum}
	 * @param pageNo
	 * @param pageSize
	 */
	List<Map<String, Object>> getShoppingCartList(Integer userId,
			Integer applicablePlatformId, Integer pageNo, Integer pageSize) throws Exception;

	/**
	 * 合并购物车
	 * 
	 * @param userId
	 * @param userTraceId
	 */
	void mergeShoppingCart(Integer userId, String userTraceId) throws Exception;


	/**
	 * 获取购物车商品总数
	 * @param userId
	 * @param id 购物车中的记录id
	 * @return
	 */
	JSONObject sumShoppingCart(Integer userId) throws Exception;
	
	
	/**
	 * 合并购物车快照
	 * @param userId
	 * @param id 购物车中的记录id
	 * @return
	 */
	JSONObject mergeShoppingCartSnap(Integer userId, String userTraceId) throws Exception;

	/**
	 * 秒杀回滚
	 * 
	 * @param userId
	 * @param mealId
	 * @param skNum
	 * @throws Exception
	 */
	void rockBackSeckillRestriction(Integer userId, Integer mealId, Integer skNum) throws Exception;
	
	/**
	 * 获取商品参与的秒杀活动
	 * 
	 * @param mealId
	 * @param applicablePlatformId
	 * @return
	 * @throws Exception
	 */
	String showGoodsSeckill(Integer mealId, Integer applicablePlatformId) throws Exception;
	
	/**
	 * 取消秒杀
	 * 
	 * @param userId
	 * @param targerId
	 * @param skNum
	 * @param applicablePlatformId
	 * @throws Exception
	 */
	void cancelSeckillRestriction(Integer userId, Integer mealId, String targerId, Integer skNum, Integer applicablePlatformId) throws Exception;
}
